using System.Web.Mvc;
using Chatu.ControlLider.Web.Models.Common;
using Chatu.ControlLider.Web.Models.Repositories;

namespace Chatu.ControlLider.Web.Controllers
{
    [Authorize(Roles = ADMINISTRATOR_ROLE)]
    public partial class ReportController : Controller
    {
        private const string ADMINISTRATOR_ROLE = "Administrator";
        private readonly IEmployeeRepository _repository;

        public ReportController()
            : this(new SqlEmployeeRepository())
        { }

        public ReportController(IEmployeeRepository repository)
        {
            _repository = repository;
        }

        public virtual ActionResult Index()
        {
            ViewData["CurrentCategory"] = "Reportes";

            return View();
        }

        public virtual ActionResult BaseReport()
        {
            ViewData["CurrentDate"] = _repository.CurrentTimeZone.ToFullDateTimeSpanish();

            return View(Views.BaseReport, _repository.GetEmployeesLaborData());
        }

        public virtual ActionResult Guardias()
        {
            ViewData["ReportName"] = "Guardias";

            return BaseReport();
        }

        public virtual ActionResult Bonos()
        {
            ViewData["ReportName"] = "Bonos";

            return BaseReport();
        }

        public virtual ActionResult Tickets()
        {
            ViewData["ReportName"] = "Cestatickets";

            return BaseReport();
        }
    }
}
